#include "conf/znx_core_conf.h"
#include "comm/znx_cpuinfo.h"



int main()
{
    if (!znx_core_conf_parse("/tmp/core_exp.yaml")) {
        if (g_core_conf) {
            ZNX_DEF_LOG_FATAL(NULL, "parse /tmp/core_exp.yaml failed, err: %v",
                &g_core_conf->err);
        }
        ZNX_DEF_LOG_FATAL(NULL, "parse /tmp/core_exp.yaml failed, err: unknow");
    }

    if (g_core_conf->g_mem_freelists_level > 0) {
        znx_mem_init((size_t)g_core_conf->g_mem_freelists_level);
    }

    if (g_core_conf->g_aligned_mem_freelists_level > 0) {
        znx_mem_init((size_t)g_core_conf->g_aligned_mem_freelists_level);
    }

    znx_modules_main_init_exec();

    if (g_core_conf->worker_threads != znx_cpu_num()) {
        ZNX_DEF_LOG_FATAL(NULL, "expect %d, but got %d",
            znx_cpu_num(), g_core_conf->worker_threads);
    }

    if (g_core_conf->tcp_accepter_threads != 2) {
        ZNX_DEF_LOG_FATAL(NULL, "expect 2, but got %d",
            g_core_conf->tcp_accepter_threads);
    }

    if (g_core_conf->g_mem_freelists_level != 8) {
        ZNX_DEF_LOG_FATAL(NULL, "expect 8, but got %d",
            g_core_conf->g_mem_freelists_level);
    }

    if (g_core_conf->g_aligned_mem_freelists_level != 4) {
        ZNX_DEF_LOG_FATAL(NULL, "expect 4, but got %d",
            g_core_conf->g_aligned_mem_freelists_level);
    }

    if (g_core_conf->worker_mem_freelist_level != 16) {
        ZNX_DEF_LOG_FATAL(NULL, "expect 100, but got %d",
            g_core_conf->worker_mem_freelist_level);
    }

    if (g_core_conf->worker_aligned_mem_freelists_level != 8) {
        ZNX_DEF_LOG_FATAL(NULL, "expect 200, but got %d",
            g_core_conf->worker_aligned_mem_freelists_level);
    }

    return 0;
}